package com.apes.fn.scm.settleCheck.model;

import com.apes.framework.jpa.BaseModel;
import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import com.apes.scm.masterdata.enumeration.model.Enumeration;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @BelongsProject: apes
 * @BelongsPackage: com.apes.fn.scm.settleCheck.model
 * @ClassName: DynamicSummary
 * @Author: pyb
 * @CreateTime: 2020-03-24 15:32
 * @Description: 动态汇总
 * @Version: 1.0
 */
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = DynamicSummary.CONST_TABLE_NAME)
public class DynamicSummary extends BaseModel {
    public static final String CONST_TABLE_NAME = "fn_dynamic_summary";
    @Id
    @Column(name = "id", length = 32)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "动态汇总", prefix = "3")
    @Comment("编码")
    private String id;

    @Column(name = "description", length = 120, nullable = false)
    @Comment("描述")
    private String description;


    @Column(name = "tablename", length = 120, nullable = true)
    @Comment("插入表名")
    private String tablename;


    @Column(name = "checktype",columnDefinition = "number(2,0) default 1")
    @Comment("查询类型")
    private Integer checktype;

    @Column(name = "bustype", length = 120, nullable = true)
    @Comment("业务描述")
    private String bustype;


    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "agent_payment_item", referencedColumnName = "id")
    @Comment("代支付项目")
    private Enumeration agentPaymentItem;

    @Column(name = "sql_inquiry", length = 4000)
    @Comment("查询sql")
    private String sqlInquiry;

    @Column(name = "sql_inquiry_header_name", length = 4000)
    @Comment("查询sql-别名")
    private String sqlInquiryHeaderName;

}
